package com.api.mapper;

import com.api.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper  //实现实体和数据表的映射关系
//@MapperScan("com.api.mapper”) 配在启动类上对mapper进行扫描，@Repository配置在Mapper接口上
//@Repository 搭配@MapperScan配置才生效，否则启动会报错，这样不需要对每个Mapper接口都添加@Mapper注解
public interface UserMapper {
    List<User> queryUserList(int pageNum, int pageSize);

    User queryUserById(int id);

    int addUser(User user) throws DataAccessException;

    int updateUser(User user) throws DataAccessException;

    int deleteUser(int id) throws DataAccessException;

    int login(String username, String password) throws DataAccessException;

}
